package com.rfsp.mcp.controller.interfaceclient;

import com.rfsp.common.base.ResultVO;
import com.rfsp.mcp.pojo.dto.MiAccountInfoDto;
import com.rfsp.mcp.pojo.dto.MiPayInfoDto;
import com.rfsp.mcp.pojo.dto.OrgDirectoryDto;
import com.rfsp.mcp.pojo.dto.OrgSubjectInfoDto;
import com.rfsp.mcp.service.interfaceclient.WSMiAccountService;
import com.rfsp.mcp.service.interfaceclient.WSMiPayService;
import com.rfsp.mcp.service.interfaceclient.WSOrgDirectoryService;
import com.rfsp.mcp.service.interfaceclient.WSOrgSubjectInfoService;
import groovy.util.logging.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping(value = "/interfaceclient/orgDirectory")
public class OrgDirectoryController {
    @Autowired
    private WSOrgDirectoryService orgDirectoryService;

    @Autowired
    private WSOrgSubjectInfoService orgSubjectInfoService;

    @Autowired
    private WSMiPayService miPayService;

    @Autowired
    private WSMiAccountService miAccountService;

    @PostMapping("/queryOrgDirectory")
    public ResultVO queryOrgDirectory(@RequestBody @Validated OrgDirectoryDto orgDirectoryDto){
        ResultVO<String> resultVO= orgDirectoryService.queryOrgDirectory(orgDirectoryDto);
        return resultVO;
    }

    //下面各方法只为测试用。只有上面第一个方法是有用的

    /**
     * 测试机构主体信息查询
     * @param orgSubjectInfoDto
     * @return
     */
    @PostMapping("/queryOrgDirectory2")
    public ResultVO queryOrgDirectory2(@RequestBody @Validated OrgSubjectInfoDto orgSubjectInfoDto){
        ResultVO<String> resultVO= orgSubjectInfoService.queryOrgSubjectInfo(orgSubjectInfoDto);
        return resultVO;
    }

    /**
     * 测试结算信息查询
     * @param miPayInfoDto
     * @return
     */
    @PostMapping("/queryOrgDirectory3")
    public ResultVO queryOrgDirectory3(@RequestBody @Validated MiPayInfoDto miPayInfoDto){
        ResultVO<String> resultVO= miPayService.queryMiPayInfo(miPayInfoDto);
        return resultVO;
    }


    /**
     * 测试账户信息查询
     * @param
     * @return
     */
    @PostMapping("/queryOrgDirectory4")
    public ResultVO queryOrgDirectory4(@RequestBody @Validated MiAccountInfoDto miAccountInfoDto){
        ResultVO<String> resultVO= miAccountService.queryMiAccountInfo(miAccountInfoDto);
        return resultVO;
    }
}
